<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>从小到大排列</title>
</head>
<body>

<script>
function sort(array) {
    var n = array.length;
    for (var i = 0; i < n; i++) {
        for (var j = 0; j < n - i - 1; j++) {
            if (array[j] > array[j+1]) {
                var temp = array[j];
                array[j] = array[j+1];
                array[j+1] = temp;
            }
        }
    }
    return array;
}

var array = [66, 33, 78, 98, 88, 99];
console.log("排序前的数组:", array);
var sortedArray = sort(array);
console.log("排序后的数组:", sortedArray);
</script>

</body>
</html>